<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        function Person(name, age, gender) {
            this.name = name;
            this.age = age;
            this.gender = gender;
        }
        //修改person原型中的tostring
        Person.prototype.toString = function () {
            return "Person[name=" + this.name + ",age" + this.age + ",gender=" + this.gender;
        }

        var per = new Person("孙悟空", 18, "男");

        console.log(per);

        var result = per.toString();

        //console.log("result="+result);

        console.log(per.__proto__.__proto__.hasOwnProperty("toString")); //true

    </script>
</head>

<body>

</body>

</html>